home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 5762 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.4 KB  |  35 lines

  1. Newsgroups: comp.lang.c
  2. Path: mxsld2.pd.infn.it!LORETI
  3. From: loreti@mxsld2.pd.infn.it (Maurizio Loreti)
  4. Subject: Re: calloc help needed
  5. X-Nntp-Posting-Host: mxsld2.pd.infn.it
  6. Message-ID: <Dn4nK7.I18@news.cern.ch>
  7. Sender: news@news.cern.ch (USENET News System)
  8. Reply-To: loreti@mxsld2.pd.infn.it
  9. Organization: I.N.F.N. Padova - CDF/CMS VAXcluster
  10. References: <1996Feb15.125431.7751@leeds.ac.uk>,<4fvmgbINNbp0@keats.ugrad.cs.ubc.ca>
  11. Date: Wed, 21 Feb 1996 13:16:53 GMT
  12.  
  13. In article <4fvmgbINNbp0@keats.ugrad.cs.ubc.ca>, c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku) writes:
  14. >In article <1996Feb15.125431.7751@leeds.ac.uk>,
  15. >A M Casey <csyamc@scs.leeds.ac.uk> wrote:
  16. > >I'm trying to allocate enough memory for an array of strings, defined as
  17. > >char * MyArray[20].
  18. > >the only manual entry I have for calloc says that it needs two values, the
  19. > >number of elements, and the size of each, but how do I actually use it?
  20. > >
  21. > >MyArray = calloc(20,50);
  22. >
  23. >This is gives you much more space than you need for the array. A character's
  24. >size is not 50!
  25. >
  26. > >doesnt work, as far as I can tell calloc returns an int.
  27. >
  28. >It is probably "implicitly defined" to return an int, because you lack a
  29. >declaration. Try including the "malloc.h" header file.
  30.  
  31. You misspelled <stdlib.h> ...
  32. --
  33. Maurizio Loreti                       http://mvxpd5.pd.infn.it/wwwcdf/mlo.html
  34. Un. of Padova, Dept. of Physics - Padova, Italy          loreti@padova.infn.it
  35.